﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using ALDIOrganizer.Properties;

namespace ALDIOrganizer
{
    public partial class ContractNewOrUpdate : Form
    {
        private bool DeletingPossible;

        public ContractNewOrUpdate()
        {
            InitializeComponent();
        }

        public ContractNewOrUpdate(int pHowManyWouldRemain) :
            this()
        {
            var pWouldAnyRemain = pHowManyWouldRemain > 0;
            btnRemove.DialogResult = pWouldAnyRemain ?
                DialogResult.Abort :
                DialogResult.None;
            DeletingPossible = pWouldAnyRemain;
        }

        private void formContractNewOrUpdate_Load(object sender, EventArgs e)
        {
            var question =   "Do you want to modify the existing contract, or to add " +
                "\na new one, with new date?";

            var paragraph1 = "In typical scenarioes of promotion, change of conditions or " +
                           "\nemployment termination etc. you should create a new contract " +
                           "\nwithout altering the archive data.";

            var paragraph2 = "Modifying pre-existent data should only be performed if this " +
                           "\nwas incorrect (eg. because of invalid input).";

            lbQuestion.Text = question;
            lbExplanation1.Text = paragraph1;
            lbExplanation2.Text = paragraph2;
        }

        private void btnRemove_Click(object sender, EventArgs e)
        {
            if (!DeletingPossible)
            {
                MessageBox.Show(
                    Resources.MESSAGEBOX_INFORMATION_CannotDeleteLastContract_MESSAGE,
                    Resources.MESSAGEBOX_INFORMATION_CannotDeleteLastContract_CAPTION,
                    MessageBoxButtons.OK,
                    MessageBoxIcon.Information);
            }
        }

        
    }
}
